import { http } from '@/http';
import { Profit, Download, Click, Translation } from '@/types/main';

interface FeedbackParams {
  data: {
    nickname: string;
    email: string;
    plan: string;
  };
}

interface ReportResponse {
  profit: Profit;
  download: Download;
  click: Click;
  translation: Translation;
  share_url: string;
}

interface FeedbackResponse {
  data: any,
  status: number,
  msg: String
}


export default {
  // 首頁
  report: () => {
    return http<ReportResponse>('post', '/union/home/index');
  },

  // 統計
  stat: ({ data = {}, config = {} } = {}) => {
    return http('post', '/union/home/stat', data, config);
  },

  feedback: (params: FeedbackParams) => {
    return http<FeedbackResponse>('post', '/union/login/feedback', params.data);
  },
};
